/**
 * @description: 保存查询条件
 * @param {string} pageName
 * @param {any} saveData
 * @return {*}
 */
export const saveKeepAliveData = (pageName: string, saveData: any) => {
  const keepAliveData =
    JSON.parse(sessionStorage.getItem('keepAliveData')) || {};
  keepAliveData[pageName] = saveData;
  sessionStorage.setItem('keepAliveData', JSON.stringify(keepAliveData));
};

/**
 * @description: 获取保存的查询条件
 * @param {string} pageName
 * @return {*}
 */
export const getKeepAliveData = (pageName: string) => {
  const getKeepAliveData = JSON.parse(sessionStorage.getItem('keepAliveData'));
  return pageName && getKeepAliveData ? getKeepAliveData[pageName] : {};
};
